<template>
  <div>
    <div class="seed_top_banner">
      <div class="seed_back_arrow" @click="back">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-zuo"></use>
        </svg>
      </div>
      <div class="seed_page_title"><span>发布公告</span></div>
      <div class="seed_page_tool"></div>
    </div>

    <div class="seed_add_body">
      <textarea class="seed_add_top" placeholder="请输入发布公告的标题..." v-model="param.n_title"></textarea>
      <div class="seed_add_middle">
        <textarea class="seed_add_centre" placeholder="请输入公告详细内容..." v-model="param.n_content"></textarea>
        <div><span>300字以内</span></div>
      </div>
      <button class="seed_add_button" @click="publish">确定发布</button>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      param:{
        n_title:'',
        n_content:''
      }
    }
  },
  created () {},
  methods: {
    back () {
      this.$router.push({name: 'Home'})
    },
    publish(){
      if(this.param.n_title==''){
        this.$toast('标题不能为空')
        return false
      }
      if(this.param.n_content==''){
        this.$toast('公告内容不能为空')
        return false
      }
      if(this.param.n_content.length>300){
        this.$toast('公告详细内容不能超过300字')
        return false
      }
      this.$request.noticSave(this.param).then(data => {
        this.$toast('发布成功')
      this.back()
    })
    }
  }
}
</script>
